<!DOCTYPE html>
<title>Test webaudio autoplay on a cross origin iframe</title>
<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
<iframe style="width: 500px; height: 500px;"></iframe>
<script>
async_test(t => {
  // Make sure this overrides any preset autoplay policy.
  internals.settings.setAutoplayPolicy('document-user-activation-required');
  internals.settings.autoplayIgnoresWebAudioEnabled = false;

  // Setup the event listener.
  window.addEventListener('message', t.step_func_done((e) => {
    assert_equals(e.data, 'suspended');
  }), { once: true });

  // Navigate the iframe to a cross origin site.
  document.getElementsByTagName('iframe')[0].src = 'http://localhost:8000/media/autoplay/resources/webaudio-iframe-no-gesture.html';
});
</script>
